package com.hspedu.enum_;
/*
 *@auther will
 *@version 1.0
 */

public class Enumeration02 {
    public static void main(String[] args) {
        System.out.println(Season.AUTUMN);
        System.out.println(Season.SUMMER);
        System.out.println(Season.WINTER);
    }
}

class Season{
    private String name;
    private String decs;// 描述

    //定义了四个对象,无法修改
    public static Season SPRING = new Season("春天","温暖");
    public static Season WINTER = new Season("冬天","寒冷");
    public static Season SUMMER = new Season("夏天","炎热");
    public static Season AUTUMN = new Season("秋天","凉爽");

    //1. 将构造器私有化，目的是防止 直接new
    //2. 去掉setXxx方法,防止属性被修改
    //3. 在Season内部直接接创建固定的对象
    private Season(String name, String decs) {
        this.name = name;
        this.decs = decs;
    }

    public String getName() {
        return name;
    }

    public String getDecs() {
        return decs;
    }

    @Override
    public String toString() {
        return "Season{" +
                "name='" + name + '\'' +
                ", decs='" + decs + '\'' +
                '}';
    }
}